/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NovoJogoRedeForm.java
 *
 * Created on 14/09/2011, 13:22:26
 */

package br.edu.unijorge.form;

import br.edu.unijorge.util.UtilX;

/**
 *
 * @author u031177
 */
public class NovoJogoRedeForm extends DialogForm {

    /** Creates new form NovoJogoRedeForm */
    public NovoJogoRedeForm(java.awt.Frame parent, boolean modal) {
        super(parent, modal, 400, 125);
        initComponents();
        UtilX.centerChild(parent, this);
        jtfServidorEndereco.setText(UtilX.getIpAddress().getHostAddress());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jtpNovoJogoRede = new javax.swing.JTabbedPane();
        jpServidor = new javax.swing.JPanel();
        jtfServidorEndereco = new javax.swing.JTextField();
        jlServidorEndereco = new javax.swing.JLabel();
        jbServidorCriar = new javax.swing.JButton();
        jtfServidorPorta = new javax.swing.JTextField();
        jlServidorPorta = new javax.swing.JLabel();
        jpCliente = new javax.swing.JPanel();
        jtfClienteEndereco = new javax.swing.JTextField();
        jlClienteEndereco = new javax.swing.JLabel();
        jtfClientePorta = new javax.swing.JTextField();
        jlClientePorta = new javax.swing.JLabel();
        jbClienteConectar = new javax.swing.JButton();
        jbCancelar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jlServidorEndereco.setText("Endereço");

        jbServidorCriar.setText("Criar");

        jtfServidorPorta.setText("2011");

        jlServidorPorta.setText("Porta (Padrão: 2011)");

        javax.swing.GroupLayout jpServidorLayout = new javax.swing.GroupLayout(jpServidor);
        jpServidor.setLayout(jpServidorLayout);
        jpServidorLayout.setHorizontalGroup(
            jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpServidorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlServidorEndereco)
                    .addComponent(jtfServidorEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlServidorPorta)
                    .addGroup(jpServidorLayout.createSequentialGroup()
                        .addComponent(jtfServidorPorta, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbServidorCriar)))
                .addContainerGap(140, Short.MAX_VALUE))
        );
        jpServidorLayout.setVerticalGroup(
            jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpServidorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlServidorEndereco)
                    .addComponent(jlServidorPorta))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpServidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtfServidorEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtfServidorPorta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbServidorCriar))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jtpNovoJogoRede.addTab("Hospedar Novo Jogo", jpServidor);

        jlClienteEndereco.setText("Endereço");

        jtfClientePorta.setText("2011");

        jlClientePorta.setText("Porta (Padrão: 2011)");

        jbClienteConectar.setText("Conectar");

        javax.swing.GroupLayout jpClienteLayout = new javax.swing.GroupLayout(jpCliente);
        jpCliente.setLayout(jpClienteLayout);
        jpClienteLayout.setHorizontalGroup(
            jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlClienteEndereco)
                    .addComponent(jtfClienteEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jlClientePorta)
                    .addGroup(jpClienteLayout.createSequentialGroup()
                        .addComponent(jtfClientePorta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbClienteConectar)))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        jpClienteLayout.setVerticalGroup(
            jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpClienteLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlClienteEndereco)
                    .addComponent(jlClientePorta))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jpClienteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtfClienteEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jtfClientePorta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbClienteConectar))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jtpNovoJogoRede.addTab("Conectar-se a um Servidor", jpCliente);

        jbCancelar.setText("Cancelar");
        jbCancelar.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseReleased(java.awt.event.MouseEvent evt) {
                jbCancelarMouseReleased(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jtpNovoJogoRede, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
                    .addComponent(jbCancelar, javax.swing.GroupLayout.Alignment.TRAILING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jtpNovoJogoRede, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jbCancelar)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jbCancelarMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jbCancelarMouseReleased
        dispose();
    }//GEN-LAST:event_jbCancelarMouseReleased

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                NovoJogoRedeForm dialog = new NovoJogoRedeForm(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jbCancelar;
    private javax.swing.JButton jbClienteConectar;
    private javax.swing.JButton jbServidorCriar;
    private javax.swing.JLabel jlClienteEndereco;
    private javax.swing.JLabel jlClientePorta;
    private javax.swing.JLabel jlServidorEndereco;
    private javax.swing.JLabel jlServidorPorta;
    private javax.swing.JPanel jpCliente;
    private javax.swing.JPanel jpServidor;
    private javax.swing.JTextField jtfClienteEndereco;
    private javax.swing.JTextField jtfClientePorta;
    private javax.swing.JTextField jtfServidorEndereco;
    private javax.swing.JTextField jtfServidorPorta;
    private javax.swing.JTabbedPane jtpNovoJogoRede;
    // End of variables declaration//GEN-END:variables

}
